<div class="row-content am-cf">
	<div class="row">
		<div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
			<div class="widget am-cf">
				<div class="widget-head am-cf">
					<div class="widget-title am-fl">保证金核减</div>
					<div class="widget-function am-fr">
						<a href="javascript:;" class="am-icon-cog"></a>
					</div>
				</div>
				<div class="widget-body am-fr">
					<form class="am-form tpl-form-line-form" id="rechargeForm" method="post">
						<input type="hidden" name="agentId" th:value="${agent.id}" />
						<div class="am-form-group">
							<label for="realName" class="am-u-sm-2 am-form-label">合伙人姓名:</label>
							<div class="am-u-sm-10" th:text="${agent.realName}"></div>
						</div>
						
						<div class="am-form-group">
							<label for="mobile" class="am-u-sm-2 am-form-label">手机号:</label>
							<div class="am-u-sm-10" th:text="${agent.mobile}" >
							</div>
						</div>
						<div class="am-form-group">
							<label for="idcard" class="am-u-sm-2 am-form-label">身份证:</label>
							<div class="am-u-sm-10" th:text="${agent.idcard}"></div>
						</div>
						<div class="am-form-group">
							<label for="idcard" class="am-u-sm-2 am-form-label">最大可核减保证金:</label>
							<div class="am-u-sm-10" th:text="${availableCredit}+'元'"></div>
						</div>
						
						<div class="am-form-group">
							<label for="amount" class="am-u-sm-2 am-form-label">核减金额:</label>
							<label for="amount" class="am-u-sm-1 am-form-label">-</label>
							<div class="am-u-sm-2 am-u-end">
								<input type="number" id="amount" class="tpl-form-input" placeholder="核减金额" name="amount" required="required" /> 
							</div>
						</div>
						<div class="am-form-group">
							<label for="creditType" class="am-u-sm-2 am-form-label">核减用途:</label>
							<div class="am-u-sm-3 am-u-end">
								<select id="creditType"  data-am-selected="{btnSize:'sm'}" name="creditType"  >
									<option value="return">退还保证金</option>
									<option value="trans">调拨保证金</option>
								</select> 
							</div>
						</div>
						<div class="am-form-group">
							<label for="memo" class="am-u-sm-2 am-form-label">备注:</label>
							<div class="am-u-sm-2 am-u-end">
								<input type="text" id="memo" class="tpl-form-input" placeholder="备注" name="memo"/> 
							</div>
						</div>
						<div class="am-form-group">
							<div class="am-u-sm-10 am-u-sm-push-2">
								
								<button type="button" onclick="javascript:$('#rechargeForm').submit();"
									class="am-btn am-btn-primary tpl-btn-bg-color-success ">提交</button>
										<button type="button" onclick="loadPage('recharge/rechargeList')"
									class="am-btn am-btn-success tpl-btn-bg-color-success ">返回</button>
							</div>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>

	</div>
	<script th:inline="javascript">
	<![CDATA[
		
	var canSubmit = true;//表单重复提交控制 
	validateUserForm();
	function validateUserForm(){  
		 $('#rechargeForm').validate({
		        errorElement : 'span',
		        errorClass : 'am-icon-times',
		        focusInvalid : true,
		        onkeyup:false,
		        ignore : "",
		        rules : {
			         amount: {
				        required: true
				      },
		            memo : {
		                maxlength: 30
		            }
		        },
		        messages : {
        	      amount: {
			        required: "请输入核减金额"
			      },
			      memo : {
		                maxlength: "最多可以输入30个汉字"
		          }
		        },
		        submitHandler : function(form) {
		        	if(canSubmit){
		        		canSubmit = false;
		        		commit('rechargeForm', 'recharge/deductSave','recharge/rechargeList');
		        	}
		        	
		        }
		    });

	}
		]]>
	</script>